home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 8
/
QRZ Ham Radio Callsign Database - Volume 8.iso
/
mac
/
files
/
p_msys
/
msysb116.exe
/
SCAN735.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-11-27
|
8KB
|
264 lines
; scan735.asm
; Here is sample source for a Scan TSR to be used with the MSYS
; Pactor scan command
; This example is for the ICOM IC-735. It may work for other
; ICOM HF radios with minor modification. The IC-735 requires
; the following command format:
; FE FE 00 tt cc data FD
; where tt is the transmitter address which is model dependent:
; IC-275 16
; IC-375 18
; IC-475 20
; IC-575 22
; IC-735 04
; IC-751 28
; IC-761 30
; Verify these in your instruction book!
;
; cc is the control code for the operation to perform (00 to
; set frequency) and data is the parameters needed for the
; particular command. The other values are hex bytes that
; must be as shown.
;
; For command 00, the frequency is given in 4 bytes, using
; BCD (binary coded decimal) with the least significant byte
; first. The frequency is expressed in Hz. Thus, for a frequency
; of 14,123.450 KHz, the four bytes would be
; 50 34 12 14
;
; The complete set of 10 bytes used to set a frequency of 7.021 MHz
; would be (in hex):
; FE FE 00 04 00 00 10 02 07 FD
; to produce the executable for this program, use the following
;
; asm scan735.asm {tasm or masm may be used}
; link scan735;
; exe2bin scan735 {makes .com file out of .exe file}
code segment
assume cs:code,ds:code
main proc far
org 0
segorg equ $
org 100h
start: jmp install
port dw 0 ;control uart base address
ten dw 10 ;divisor
thousand dw 1000
cmd db 0FEh,0FEh
db 00
db 04 ;the tt value, 04 for the IC-735
db 00 ;the cc value - set frequency
freq db 'freq' ;frequency in BCD, LSB first
db 0FDh
temp db 'hhhkkkmm' ;work space build freq
savequot dw 0
;debug db 'xx $'
putser proc near
; send char in AL
push dx
push ax
mov dx,port
add dx,5 ;line status register
wait1: in al,dx
and al,20h ;check transmit holding reg
jz wait1 ;not ready yet
pop ax
mov dx,port
out dx,al ;send char to serial port
; The following commented out lines were used for debugging. They
; displayed each byte sent to the radio in hex.
; push ax
; push bx
; push cx
; push dx
; mov ah,al
; mov cl,4
; shr al,cl
; add al,'0'
; cmp al,'9'
; jle q1
; add al,7
;q1:
; mov debug,al
; and ah,15
; add ah,'0'
; cmp ah,'9'
; jle q2
; add ah,7
;q2:
; mov debug+1,ah
; mov dx,offset debug
; mov ah,9
; int 21h
; pop dx
; pop cx
; pop bx
; pop ax
pop dx
ret
putser endp
putserstr proc near
; sends string pointed to by bx, cx has number of bytes
push ax
push bx
push cx
psloop:
mov al, byte ptr [bx]
call putser
inc bx
dec cx
cmp cx,0
je putserstrexit
jmp psloop
putserstrexit:
pop cx
pop bx
pop ax
ret
putserstr endp
handler:
STI ; enable interrupts
; ; If we don't we will get overruns
; ; on the serial ports for the tnc's
push ds ; save some registers
push ax
push ax ; save ax a second time
mov ax,cs
mov ds,ax ; set up ds
pop ax ; get back the ax we were called with
;
; upon entry, dx has port address
; ax has high order part of frequency
; bx has low order part of frequency
mov port,dx
; div divides DX:AX giving quot in AX, rem in DX
mov dx,ax
mov ax,bx
; We have a bit of a problem in that the DIV instruction
; requires that the quotient will fit in a 16 bit register.
; But a frequency like 14.350, which is 14350000 in the
; long (32 bit) variable and when divided by 10 the
; quotient won't fit in 16 bits (AX).
;
; So here is what we will do...
; First divide the original frequency by 1000. This will
; give a quotient <= 30000 which will fit.
; The remainder from this division will be run thru the
; divide by 10 to get the digits loop three times.
; Then we take the quotient and use the same instructions
; to do the other 5 required digits
div thousand ;rem in dx, quot in ax
mov savequot,ax
mov ax,dx ;set up for divide
sub dx,dx
mov cx,3 ;number of digits
mov bx,offset temp ;place for first
dloop1:
div ten
add dl,'0' ;convert to ascii
mov byte ptr [bx],dl
sub dx,dx
inc bx
dec cx
cmp cx,0
jne dloop1
mov ax,savequot
sub dx,dx
mov cx,5
dloop2:
div ten
add dl,'0' ;convert to ascii
mov byte ptr [bx],dl
sub dx,dx
inc bx
dec cx
cmp cx,0
jne dloop2
; We now have 8 ascii bytes at temp, lsb first that is the freq
; We need to pack them into bcd, putting them at label freq
mov ah,temp+1
and ah,0Fh ;convert to bcd
mov cl,4
shl ah,cl ;shift left 4
mov al,temp
and al,0Fh
add ah,al
mov freq,ah
mov ah,temp+3
and ah,0Fh ;convert to bcd
shl ah,cl ;shift left 4
mov al,temp+2
and al,0Fh
add ah,al
mov freq+1,ah
mov ah,temp+5
and ah,0Fh ;convert to bcd
shl ah,cl ;shift left 4
mov al,temp+4
and al,0Fh
add ah,al
mov freq+2,ah
mov ah,temp+7
and ah,0Fh ;convert to bcd
shl ah,cl ;shift left 4
mov al,temp+6
and al,0Fh
add ah,al
mov freq+3,ah
mov cx,10
mov bx,offset cmd
call putserstr
pop ax
pop ds
iret
main endp
install:
mov dx,offset msg1
mov ah,9
int 21h
mov dx,offset handler
mov al,0D3h
mov ah,25h
int 21h
mov dx,(offset install - segorg +15) shr 4
mov ah,31h
int 21h
msg1 db 'Scan TSR loaded for ICOM IC-735 using Int D3',13,10,'$'
code ends
end start